<?php $nota =0.0;
$contar=0;
foreach ($criteriosEvaluations as $criterio):
	$nota=$nota + ($criterio['CriteriosEvaluation']['puntaje']);
	++$contar;

endforeach;
$final=$nota/$contar;
 ?>


<div class="evaluations form">
<?php echo $this->Form->create('Evaluation'); ?>
	<fieldset>
		<legend><?php echo __('Retroalimentación'); ?></legend>
	<?php
		echo $this->Form->input('id');
		echo $this->Form->hidden('institution_id');
		echo $this->Form->hidden('preview_id');
		echo $this->Form->hidden('group_id');
		echo $this->Form->hidden('user_id');
		echo $this->Form->hidden('plantilla_id');
		echo $this->Form->hidden('tipo');
		echo $this->Form->input('nota',array('label'=>'Nota final','value'=>$final));
		echo $this->Form->input('comentario');
	?>

	</fieldset>
<?php echo $this->Form->end(__('Finalizar')); ?>
</div>
<!--<div class="related">
	<?php if (!empty($alumnos)): ?>
	<?php echo $this->Form->create('EvaluationsUser',array('controller'=>'evaluationsUsers','action' => 'add_evaluation')); ?>
		<?php
		$i = 0;
		$id_evaluation=$evaluation['Evaluation']['id'];
		$tipo_evaluation=$evaluation['Evaluation']['tipo'];
		$nota=$final;
		foreach ($alumnos as $alumno): ?>

            <?php
				echo $this->Form->input('EvaluationsUser.'.$i.'.user_id',array('label'=>'','value' => $alumno['User']['id']));
				echo $this->Form->input('EvaluationsUser.'.$i.'.evaluation_id',array('label'=>'','options' => array($id_evaluation=>$id_evaluation)));
				echo $this->Form->input('EvaluationsUser.'.$i.'.nota',array('label'=>'','options' => array($nota=>$nota)));
				echo $this->Form->input('EvaluationsUser.'.$i.'.tipo',array('label'=>'','options' => array($tipo_evaluation=>$tipo_evaluation)));
				++$i;
			?>
	<?php endforeach; ?>

<?php endif; ?>
				<?php echo $this->Form->end(__('finalizar'),true); ?>
		
</div> -->
<div class="actions">
	<h3><?php echo __('Actions'); ?></h3>
	<ul>
		<?php if($this->Session->read('Auth.User.role_id')=='1'): ?>	
		<li><?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $this->Form->value('Evaluation.id')), null, __('Are you sure you want to delete # %s?', $this->Form->value('Evaluation.id'))); ?></li>
		<li><?php echo $this->Html->link(__('Listar Evaluationes'), array('action' => 'index')); ?></li>
		<li><?php echo $this->Html->link(__('Listar Institutiones'), array('controller' => 'institutions', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('Nueva Institución'), array('controller' => 'institutions', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('Listar Proyectos'), array('controller' => 'projects', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('Nuevo Proyecto'), array('controller' => 'projects', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('Listar Usuarios'), array('controller' => 'users', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('Nuevo Usuario'), array('controller' => 'users', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('Listar Plantillas'), array('controller' => 'plantillas', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('Nueva Plantilla'), array('controller' => 'plantillas', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('Listar Criterios'), array('controller' => 'criterios', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('Nuevo Criterio'), array('controller' => 'criterios', 'action' => 'add')); ?> </li>
		<?php endif; ?>		
		<?php if($this->Session->read('Auth.User.role_id')=='6'): ?>	
			<li><?php echo $this->Html->link(__('Grupos para evaluar'), array('controller' => 'evaluations', 'action' => 'index2')); ?> </li>
		<?php endif; ?>
	</ul>
</div>
